package cn.yunyichina.scheduler.jobs.job.pay;

import cn.yunyichina.scheduler.jobs.service.pay.CheckingAccountsService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.type.simple.api.SimpleJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by JoeZ on 2016/11/17.
 */
@Component
public class CheckingAccountsJob implements SimpleJob {

    private static final Logger logger = LoggerFactory.getLogger(CheckingAccountsJob.class);

    private static final AtomicInteger count = new AtomicInteger(0);

    @Resource
    private CheckingAccountsService checkingAccountsService;

    @Override
    public void execute(ShardingContext shardingContext) {
        int current = count.addAndGet(1);
        logger.info("第[{}]次三方对账平台账单拉取任务开始执行", current);
        checkingAccountsService.doExecute();
        logger.info("第[{}]次三方对账平台账单拉取任务执行结束", current);

    }
}
